package org.cnbi.service.impl;


import java.util.List;

import org.cnbi.dao.IHandleDao;
import org.cnbi.entity.Role;
import org.cnbi.service.IRightService;
import org.cnbi.utils.exception.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Copyright © 2014中国经邦. All rights reserved.
 * ----User Manage 用户管理Service
 * @author zhh
 * @date 2014年4月24日下午16:04
 * @cnbi-service
 */
@Service("rightService")
public class IRightServiceImpl implements  IRightService{
	
	@Autowired
	private IHandleDao handleDao;

	@SuppressWarnings("unchecked")
	@Override
	public List<Role> queryList(String sql, Object obj) {
		try {
			return (List<Role>) handleDao.query(sql, obj);
		} catch (Exception e) {
			throw new BusinessException("执行..查询[角色列表]..."+sql+e.getMessage());
		}
	}

	@Override
	public void addRole(String sql, Object obj) {
		try {
			 handleDao.execute(sql, obj);
		} catch (Exception e) {
			throw new BusinessException("执行..添加[角色]..."+sql+e.getMessage());
		}
		
	}

	@Override
	public void removeRole(String sql, Object obj) {
		try {
			 handleDao.execute(sql, obj);
		} catch (Exception e) {
			throw new BusinessException("执行..删除[角色]..."+sql+e.getMessage());
		}
		
	}

	@Override
	public void editRole(String sql, Object obj) {
		try {
			 handleDao.execute(sql, obj);
		} catch (Exception e) {
			throw new BusinessException("执行..修改[角色]..."+sql+e.getMessage());
		}
		
	}
	
	

}
